UIReNamePopup = UIBase.New(PanelNames.UIReNamePopup)

function UIReNamePopup:Init(deckIdx)
    self.deckIdx = deckIdx
end

function UIReNamePopup:OnCreate()
    self.txtInputName = self:GetChild("Input_CardName")
    self.btnSure = self:GetChild("Btn_Confirm")
    self.btnCancel = self:GetChild("Btn_Cancel")
    self:AddEvent()
    self:InitView()
end

function UIReNamePopup:AddEvent()
    self:RegisterOnClick(self.btnSure,self.OnClickSure)
    self:RegisterOnClick(self.btnCancel,self.OnClickCancel)
end

function UIReNamePopup:InitView()

end

function UIReNamePopup:OnClickSure()
    local name = self.txtInputName.text
    SetPlayerPrefs("DeckName"..self.deckIdx,name)
    FireEvent(UIEvent.DeckRename)
    closeUI(PanelNames.UIReNamePopup)
end

function UIReNamePopup:OnClickCancel()
    closeUI(PanelNames.UIReNamePopup)
end

function UIReNamePopup:Refresh()
end

function UIReNamePopup:OnClickBack()
    closeUI(PanelNames.UIReNamePopup)
end

return UIReNamePopup